                <!-- Build page from here: -->
                <div class="row-fluid">
                    <div class="span12">
						
		<div class="span5">
			<div class="box">
				<div class="title">
					<h4> 
						<span>Form Data Gudang</span>
					</h4>
					
				</div>
				<div class="content">

<?php //echo $message; ?>
<?php //echo validation_errors();?>
<?php echo form_open($action,$form_attr);?>
		
						<div class="form-row row-fluid">
							<div class="span12">
								<div class="row-fluid">
									<label class="form-label span4" for="maxlenght">ID Bahan</label>
									<input class="span8" id="id_bahan" name="id_bahan" type="text" placeholder="ID Bahan" maxlength="6" value="<?php echo (isset($gudang['id_bahan']))?$gudang['id_bahan']:'';?>" <?php echo $disable; ?> />
								</div>
							</div>
						</div>
						
						<input name="id" type="hidden" value="<?php echo (isset($gudang['id_bahan']))?$gudang['id_bahan']:'';?>"/>					
						<div class="form-row row-fluid">
							<div class="span12">
								<div class="row-fluid">
									<label class="form-label span4" for="normal">Nama Bahan</label>
									<input class="span8" id="nama_bahan" name="nama_bahan" type="text" placeholder="Nama Bahan" value="<?php echo set_value('nama_bahan')?set_value('nama_bahan'):$gudang['nama_bahan'];?>"/>
								</div>
							</div>
						</div>
						
						<div class="form-row row-fluid">
							<div class="span12">
								<div class="row-fluid">
									<label class="form-label span4" for="normal">Jumlah</label>
									<input class="span8" id="jumlah" name="jumlah" type="text" placeholder="Jumlah" value="<?php echo set_value('jumlah')?set_value('jumlah'):$gudang['stok'];?>"/>
								</div>
							</div>
						</div>
						
						<div class="form-row row-fluid">
							<div class="span12">
								<div class="row-fluid">
									<label class="form-label span4" for="prependedInput">Harga</label>
									<div class="input-prepend">
										<span class="add-on">Rp</span><input class="span10" id="harga" name="harga" size="16" type="text" placeholder="0000" value="<?php echo set_value('harga')?set_value('harga'):$gudang['harga'];?>"/>
									</div>
<!--									<span class="help-block blue span8">Isi dengan angka</span> -->
								</div>
							</div>
						</div>
						
						<div class="form-row row-fluid">
							<div class="span12">
								<div class="row-fluid">
									<label class="form-label span4" for="checkboxes">Satuan</label>
									<div class="span8 controls"> 										
										<select id="id_satuan" name="id_satuan">
										<?php if($disable != ''){?>
										<option selected="selected" value="<?php echo $gudang['id_satuan'];?>"><?php echo $gudang['satuan'];?></option>
										<?php }?>
										<?php foreach ($satuan as $row){ ?>
											<option value="<?php echo $row->id_satuan;?>"><?php echo $row->satuan;?></option>
										<?php } ?>										
										</select>										
									</div> 
								</div>
							</div> 
						</div>
						
						<div class="form-row row-fluid">
							<div class="span12">
								<div class="row-fluid">
									<label class="form-label span4" for="checkboxes">Kategori</label>
									<div class="span8 controls"> 										
										<select id="id_kategori_bahan" name="id_kategori_bahan">
										<?php if($disable != ''){?>
										<option selected="selected" value="<?php echo $gudang['id_kategori_bahan'];?>"><?php echo $gudang['nama_kategori_bahan'];?></option>
										<?php }?>
										<?php foreach ($kategori_bahan as $row){ ?>
											<option value="<?php echo $row->id_kategori_bahan;?>"><?php echo $row->nama_kategori_bahan;?></option>
										<?php } ?>										
										</select>										
									</div> 
								</div>
							</div> 
						</div>

						<div class="form-actions">
						   <button type="submit" class="btn btn-info">Simpan</button>
						   <button type="button" class="btn"><?php echo $link_back;?></button>
						</div>
					</form>
				</div>
			</div><!-- End .box -->
		</div><!-- End .span6 -->		
	</div><!-- End .span8 -->					
</div><!-- End .row-fluid -->

    <script type="text/javascript" src="<?php echo base_url();?>assets/plugins/forms/validate/jquery.validate.min.js"></script>
    <script type="text/javascript" src="<?php echo base_url();?>assets/plugins/forms/uniform/jquery.uniform.min.js"></script>	

	<script type="text/javascript">
		var disable = "<?php echo $disable;?>";
//		alert(disable);
        // document ready function
        $(document).ready(function() {
            $("input").not('.nostyle').uniform();
            $("#FormGudang").validate({
                rules: {
					id_bahan: {
						required: (disable != "disabled" ? true : false),
						minlength: 6,
						remote: (disable != "disabled" ? {
							url: "<?php echo base_url();?>data_gudang/cek_id",
							type: "post"
						}	: false	)				
					},
                    nama_bahan: {
                        required: true,
						remote: (disable != "disabled" ? {
							url: "<?php echo base_url();?>data_gudang/cek_name",
							type: "post"
						}	: false	)
                    },
                    jumlah: {
                        required: true,
						digits: true
                    },
					harga: {
						required: true,
						digits: true
					}
                },
                messages: {
					id_bahan:{
						remote: "sudah ada"
					},
					nama_bahan:{
						remote: "sudah ada"
					},
                    username: {
                        required: "Fill me please",
                        minlength: "My name is bigger"
                    },
                    password: {
                        required: "Please provide a password",
                        minlength: "My password is more that 6 chars"
                    }
                }   
            });
        });
    </script>